class ResultDTO<T> {
    constructor() {
        this.code = 0;
    }




    public code: number | undefined;
    public message: string | undefined;

    public result?: T;




    public static success<T>(data: T): ResultDTO<T> {
        let result = new ResultDTO<T>();
        result.code = 0;
        result.message = '';
        result.result = data;
        return result;

    }



    public static fail<T>(err: string | undefined): ResultDTO<T> {
        let result = new ResultDTO<T>();
        result.code = -1;
        result.message = err;
        return result;
    }

}

export default ResultDTO;